<?php
if ($_SERVER['HTTP_REFERER']){
$id = $_POST['id'];
$host = 'localhost';
$port = '3306';
$user = 'root';
$password = 'pass';
$database = 'db';
$con = mysql_connect($host.':'.$port,$user,$password);
mysql_select_db($database,$con);
$query = "select * from go where id = ".$id;
$result = mysql_query($query,$con);
$line = mysql_fetch_array($result);
$url = $line['url'];
if ($url){
$list=array("url"=>$url);
}
else
$list=array("url"=>"0");
echo json_encode($list);
}
else
echo 'Error';
/*
CREATE TABLE IF NOT EXISTS `go` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `url` varchar(200) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
*/
?>